1168 stories
·
0 followers

Why doesn’t WM_ENTER­IDLE work if the dialog box is a Message­Box?

2 Shares

Last time, we looked at how the owner of a dialog can take control just before the dialog box message loop goes idle. I said that I pulled a trick.

The trick is that I used the common file open dialog instead of a simple Message­Box. Indeed, if you replace the call to Get­Open­File­Name with a call to Message­Box, then no WM_ENTER­IDLE message arrives, and you get no beeping. What’s going on?

A dialog can suppress the WM_ENTER­IDLE message by adding the DS_NO­IDLE­MSG dialog style to its template. And that’s what the template used by the Message­Box function does.

So the WM_ENTER­IDLE trick does require a small amount of cooperation from the dialog box, namely that it doesn’t disable WM_ENTER­IDLE messages.

But say you can guarantee the cooperation of the dialog box because you are the dialog box. Right now, the WM_ENTER­IDLE message allows a dialog owner to be notified when the dialog message loop is about to go idle. But what if the dialog box itself wants to know, so it can customize its own message loop?

We’ll look at that next time.

The post Why doesn’t <CODE>WM_<WBR>ENTER­IDLE</CODE> work if the dialog box is a <CODE>Message­Box</CODE>? appeared first on The Old New Thing.

Read the whole story
Share this story
Delete

Hegseth, Trump had no authority to order Anthropic to be blacklisted, judge says

1 Share

"Classic First Amendment retaliation." That's how US District Judge Rita Lin described the Department of War's effort to blacklist Anthropic and designate it a supply-chain risk.

By all appearances, "these measures appear designed to punish Anthropic," Lin wrote in an order granting Anthropic's request for a preliminary injunction.

Officials seemingly had no authority to take such extreme actions without considering less restrictive alternatives or offering any evidence that Anthropic posed an urgent risk to national security, Lin said. Instead, "the Department of War’s records show that it designated Anthropic as a supply chain risk because of its 'hostile manner through the press.'"

"Punishing Anthropic for bringing public scrutiny to the government’s contracting position is classic illegal First Amendment retaliation," Lin said.

Anthropic's spokesperson told Ars the firm is "grateful to the court for moving swiftly, and pleased they agree Anthropic is likely to succeed on the merits." But Anthropic remains in a difficult position, still afraid that the fight will block it from competing for lucrative government contracts. In a blog earlier this month, Anthropic maintained that "Anthropic has much more in common with the Department of War than we have differences" and should be working together to deploy AI safely across government. Anthropic is still walking the same line in the aftermath of Lin's order.

"While this case was necessary to protect Anthropic, our customers, and our partners, our focus remains on working productively with the government to ensure all Americans benefit from safe, reliable AI," Anthropic's spokesperson said.

DoW official calls order a "disgrace"

For Anthropic this fight could be existential. After the DoW's actions, three trade deals were promptly cancelled, while other potential partners delayed talks. The company showed it was already suffering irreparable harms that would only worsen the longer the blacklisting was upheld—including losing potentially billions in private and government contracts the company expected to sign over the next five years, Lin noted.

To prevent ongoing harms, Lin ordered a preliminary injunction blocking US agencies from complying with directives from Donald Trump and Secretary of War Pete Hegseth.

However, she also granted the government's request for an administrative stay, which delays the injunction from taking effect for seven days. That gives the government a brief window to seek an emergency stay from an appeals court.

Asked for comment, DoW pointed to statements on X from Under Secretary of War Emil Michael, who emphasized that the supply-chain risk designation still applies over the next week. Showing that Trump officials don't plan to back off the fight, Michael claimed that Lin's order was "a disgrace" and contained "factual errors" due to the judge's supposed rush to order the injunction. According to Michael, Lin did not fully consider how disrupting Hegseth's directive could "disrupt" how US military operations are conducted.

However, Lin cited a brief filed in support of Anthropic from military leaders, who warned that letting the directive stand "will materially detract from military readiness and operational safety." Anthropic has argued that its technology is not ready to be used for mass surveillance of Americans or in fully autonomous lethal weapons, potentially posing civil rights risks if leveraged now.

Lin noted that the case touched on "an important public debate," which is whether an AI company can dictate how the government uses its models. But it was not up to her to decide if AI firms or the government should be in charge of deciding what AI uses are safe for the public.

Instead, she had to rule on whether government officials violated Anthropic's First Amendment rights, denied Anthropic due process, or acted arbitrarily or capriciously. And at this stage of the case, Anthropic has shown enough to prove it's likely to succeed on all claims, she said.

DoW is not authorized to "designate a domestic vendor a supply chain risk simply because a vendor publicly criticized DoW’s views about the safe uses of its system," Lin wrote. In fact, "that designation has never been applied to a domestic company and is directed principally at foreign intelligence agencies, terrorists, and other hostile actors," she said.

"I don't know": Lawyer has no defense of Hegseth

The DoW began using Anthropic's Claude in March 2025 and had been using it for the past year without ever raising any concerns that Anthropic's terms limiting certain uses posed a national security risk, Lin said.

Rather, the government thoroughly vetted Claude before implementing it, praised Anthropic publicly, and planned to expand the partnership.

The amicable nature of the partnership only changed, the judge said, after DoW sought to deploy Claude on a military platform and Anthropic ultimately agreed to do so with "two critical exceptions: mass surveillance of Americans and lethal autonomous warfare."

Based on its testing, Anthropic could not guarantee that Americans' civil rights would not be infringed if Claude was used for these purposes, Anthropic said. If the government disliked the terms, Anthropic repeatedly said it would understand if another vendor was selected, simply bowing out to avoid compromising on AI safety principles that might "undercut Anthropic's core identity," Lin wrote.

Calling out Anthropic for "utopian idealism," DoW officials blasted Anthropic for supposedly trying to get the government to let a private company decide how military operations go down.

"You can’t have an AI company sell AI to the Department of War and [then say] don’t let it do Department of War things," Michael told the press.

They accused Anthropic of trying to use the DoW dispute to spin up positive press, and Trump joined the chorus. On Truth Social, he labeled Anthropic a "radical left, woke company," allegedly putting their "selfishness" above national security. Following Trump's post, Hegseth took to X, writing that "Anthropic delivered a master class in arrogance and betrayal as well as a textbook case of how not to do business with the United States Government or the Pentagon."

In both posts, officials claimed that orders to blacklist Anthropic were effective immediately, but neither cited what authority they had to do so.

During oral arguments, a government lawyer later admitted that "he was not aware of any statute that gave Secretary Hegseth the authority to issue such a prohibition and agreed that the statement had 'absolutely no legal effect at all,'" Lin wrote. Further, "when asked why Hegseth made a public statement that had no legal effect and that did not reflect the immediate intent of DoW, counsel stated, 'I don’t know.'"

Perhaps most glaringly, Hegseth seemed to contradict himself when arguing that Anthropic at once "presented a grave threat to national security" requiring a supply-chain risk designation and also "Anthropic was essential to national security" and could be compelled to provide services under the Defense Production Act.

The only reason that the government gave for labeling Anthropic a national security risk was that the company could supposedly update their products and compromise systems. They claimed that Anthropic would be motivated to sabotage the military as retaliation for the directives.

But Lin didn't find that likely, either, since any other IT provider could potentially introduce the same risks. More importantly, Anthropic showed unrebutted evidence that it would be impossible to force updates or otherwise control the government's systems. To the judge, any national security risk could be foreclosed by simply ending the military's contract with Anthropic, which Anthropic had already agreed would be understandable.

Lacking any statutory basis, it seemed clear from officials' statements that Anthropic was being punished for publicly criticizing the military's plans, the judge concluded.

As Anthropic alleged, "defendants set out to publicly punish Anthropic for its 'ideology' and 'rhetoric,' as well as its 'arrogance' for being unwilling to compromise those beliefs," the judge said. "Secretary Hegseth expressly tied Anthropic’s punishment to its attitude and rhetoric in the press."

Anthropic retaliation "deeply troubling," judge says

On top of rushing to shut down government contracts with Anthropic and influence its commercial deals with any business that also hoped to work with DoW, Hegseth also failed to give Anthropic an opportunity to defend itself from claims before taking action that the record shows wasn't urgent.

Civil rights and public safety advocates had urged the court to block the government's actions or else risk a chilling effect preventing any AI firm from speaking up about unsafe government AI uses.

Ultimately, Lin agreed that any time the government raised a red flag that a vendor was an "adversary," it was "deeply troubling."

That could "chill open deliberation" and "professional debate" among those "best positioned to understand AI technology" and its potential for "catastrophic misuse," the judge wrote.

As the government likely moves to try to block the preliminary injunction, their argument contends that Lin's order could force the government to pay for Anthropic products and never get that money back. They also claimed they were conducting an audit to see if any security risks currently exist that could justify the supply-chain risk designation.

Lin doesn't see it that way, though. She wrote that "the preliminary injunctive relief that the Court authorizes does not require the government to continue to use Claude on its national security systems." She also noted that "the government 'cannot suffer harm from an injunction that merely ends an unlawful practice.'"

Read full article

Comments



Read the whole story
Share this story
Delete

"The last straw"—RFK Jr.'s anti-vaccine ally angrily quits CDC panel after spat

1 Share

One of the federal vaccine advisors hand-selected by anti-vaccine Health Secretary Robert F. Kennedy Jr. has angrily resigned from his position, complaining of "drama" amid a spat with a spokesperson. Robert Malone—a former researcher turned outspoken anti-vaccine activist and conspiracy theorist—confirmed he was stepping down Tuesday afternoon to CQ Roll Call, which first reported the news.

He told the outlet that his decision to quit came after a "miscommunication" about the fate of the Centers for Disease Control and Prevention's Advisory Committee on Immunization Practices (ACIP). Kennedy had populated ACIP with anti-vaccine allies including Malone, who served as vice chair, after summarily firing all 17 experts on the panel last June. Last week, a federal judge temporarily blocked Kennedy's ACIP appointments, including Malone. He also stayed the changes that its members had made to federal vaccine guidance, as well as the dramatic overhaul of the childhood vaccine schedule Kennedy made without them. The judge ruled all the moves were likely illegal.

On Thursday, Malone claimed on social media that the Department of Health and Human Services (HHS) had disbanded ACIP and planned to completely reconstitute it (again), without appealing the judge's ruling or defending Kennedy's ACIP picks from the judge's claims that they were unqualified. But soon after, Malone retracted his claim, saying it was a miscommunication and that disbanding ACIP was merely one of the "options being considered."

Drama

HHS spokesperson Andrew Nixon then released a statement to media pointing to Malone's retraction and adding, "Unless officially announced by us, any assertions about what we are doing next is baseless speculation."

Malone told Roll Call today that Nixon's response was what led to his departure. "After Andrew trashing me with the press, I am done with the CDC and ACIP," Malone said in a text message Tuesday morning. "That was the last straw."

"Suffice to say I do not like drama, and have better things to do," he added.

HHS Assistant Secretary of Public Affairs Rich Danker and former ACIP Chair Martin Kulldorff, who now serves as the HHS chief science officer, then contacted Roll Call on Tuesday to provide a statement confirming Malone's departure and defending Nixon. "In light of the court ruling and the enormous amount of volunteer time provided by ACIP members to enhance public health, I can sympathize with [Malone's] decision to step away," Kulldorf reportedly said. "As for Andrew Nixon, I found him to be professional and honest in all his work supporting ACIP." Kulldorff and Danker declined further comment.

Malone, in contrast, wasn't done speaking. In further comments to The New York Times, he said his departure "was not an impulsive decision."

"Hundreds of hours of uncompensated labor, incredible hate from many quarters, hostile press, internal bickering, weaponized leaking, sabotage—I have better things to do," he said.

Joseph Hibbeln, another ACIP member selected by Kennedy who often disagreed with Malone, told the Times that Malone's stated wish to avoid drama "contrasts with his prior dramatic and confusing statements."

"It is good that Dr. Malone wishes now to decrease drama regarding vaccines," Hibbeln said.

Read full article

Comments



Read the whole story
Share this story
Delete

All of DOGE’s work could be undone as lawsuit against Musk proceeds

1 Share

Elon Musk must defend himself against a lawsuit alleging that he unlawfully seized too much power as the leader of the Department of Government Efficiency (DOGE), a judge ruled Monday.

According to the plaintiffs, Musk needed Senate confirmation before directing DOGE on drastic actions like eliminating agencies, mass firings, and steep budget cuts. Allegedly going far beyond the authority granted in President Donald Trump's most expansive DOGE executive orders, Musk took every inch of power granted and then increasingly used it to overreach unlike any presidential advisor who came before, the suit says.

In her opinion partly denying a motion to dismiss, US District Judge Tanya S. Chutkan did not buy the US government's defense that Musk held no office formally established by law—and therefore did not need Senate confirmation and cannot be alleged to have exceeded his authority under the Constitution's Appointments Clause.

"Nobody thinks, for instance, that the White House Chief of Staff or White House Counsel are officers in any fashion, despite the fact they may exercise tremendous influence across the government," the government's motion to dismiss said.

Chutkan called the defense "disquieting."

"Defendants appear to make the extraordinary argument that an individual who holds an important office and wields immense power is not subject to the Appointments Clause so long as the office was unlawfully created, and the power was unlawfully seized," Chutkan said.

"Under that interpretation, the President could evade Appointments Clause scrutiny by (1) usurping Congress’s power to create a principal office and assign it powers, and (2) unilaterally appointing an official to that office without Senate confirmation," the judge continued. "The court will not countenance such a two-fold attack on Congress’s role in our system of checks and balances," she wrote, noting that "if the President unilaterally creates a principal office, endows it with unlawful powers, and fills it without Senate confirmation, that is more—not less—reason for Appointments Clause scrutiny."

Chutkan also declined to view Musk's influence as akin to that of Trump's cabinet members, writing that "the alleged powers of the head of DOGE are clearly weighty and important."

For now, plaintiffs have shown enough to allege that as DOGE's head, Musk exercised "almost 'unchecked' discretion" and received "minimal supervision." Reporting only to Trump, it seemed plausible that Musk could take any step he wanted, knowing he would get the "rubber stamp" of the president.

At this stage, the judge emphasized that "plaintiffs have adequately pled that the head of DOGE is an officer of the United States" and that the position still unlawfully exists in government. And while DOGE is scheduled for termination on July 4, 2026, "there is no termination date for the overarching DOGE entity or its leader, suggesting permanence," plaintiffs had noted.

The lawsuit was raised by nonprofits that were allegedly harmed by DOGE's broad government cuts. Their case was later consolidated with a similar lawsuit brought by a coalition of states led by New Mexico. It was filed in February 2025, before Musk left DOGE in May, and plaintiffs alleged that their claims about Musk's unchecked power also apply to his successors.

In a loss, every harmful move that DOGE made could possibly be undone.

"If Plaintiffs prevail on their claim that Musk was not constitutionally appointed and therefore lacked authority to exercise the power of a principal officer, the court could vacate Musk-initiated policies or cuts that are causing Plaintiffs ongoing harm," Chutkan wrote.

Musk may regret X posts bragging about DOGE

Unsurprisingly, Musk's posts on X were cited in the lawsuit as part of "ultra vires" claims that the executive branch made an "extreme legal error" in allowing him to assume an outsize government role.

On X, Musk made several posts suggesting that DOGE was operating at his direction, plaintiffs alleged in their complaint. That included posts like “USAID is a criminal organization. Time for it to die.” Additionally, Musk posted, "What is this ‘Department of Education’ you keep talking about? I just checked and it doesn’t exist," prior to Trump confirming he told Musk to look into the department. And perhaps most damning to the government's defense, in reference to the Consumer Financial Protection Bureau—which senators claimed Musk long wanted to kill off—Musk posted, "CFPB RIP."

The Office of Personnel Management also seemed to borrow Musk's exact template for a "Fork in the Road" email giving government employees an option to resign and accept buyouts. Musk sent a similar email after taking over Twitter as he quickly moved to reduce staff.

Again, the government tried to claim that Musk couldn't be doing anything wrong in the role because he wasn't violating any specific statute in this unique role.

The judge rejected that logic. Pointing to Musk's X posts and other public statements from the White House and DOGE officials, Chutkan said that plaintiffs had shown enough evidence that "defendants are exercising immense power without any grant of statutory authority whatsoever. That is the sort of 'extreme legal error' that can sustain a claim for ultra vires review."

As the lawsuit proceeds, plaintiffs will try to prove what many critics claimed was obvious after Trump appointed Musk as a special government employee: that Musk was acting as president.

Perhaps notably, Musk claimed on X—after his breakup with Trump—that Trump would have never won the election without his support.

Although Musk never claimed to be acting as president, he deemed himself "first buddy" in another X post, which lawmakers cited as a sign that Musk was acting as "co-president." Among the critics was Senator Bernie Sanders, who wrote on X that Musk seemed to be pulling the strings and became $200 billion richer after Trump got elected.

"Are Republicans beholden to the American people?" Sanders said. "Or President Musk? This is oligarchy at work."

For plaintiffs, the lawsuit is not about Musk as an individual, though. They allege that without an injunction preventing further government cuts and an order undoing DOGE's worst work, Americans will continue to suffer from Musk's unprecedented power grab even as his successors maintain DOGE's mission.

Elon Musk "has roamed through the federal government unraveling agencies, accessing sensitive data, and causing mass chaos and confusion for state and local governments, federal employees, and the American people," plaintiffs argued. "Oblivious to the threat this poses to the nation, President Trump has delegated virtually unchecked authority to Mr. Musk without proper legal authorization from Congress and without meaningful supervision of his activities. As a result, he has transformed a minor position that was formerly responsible for managing government websites into a designated agent of chaos without limitation."

Read full article

Comments



Read the whole story
Share this story
Delete

China Is Mass-Producing Hypersonic Missiles For $99,000

1 Share
Longtime Slashdot reader cusco writes: A private company in China has developed hypersonic missiles that cost the same as a Tesla Model X. This missile, the YKJ-1000, is being marketed for sale at a reported price of $99,000, and it's in mass production now after successful tests. That is far below what countries will spend to target and shoot down the missile if it's heading their way. Besides the low cost, they can be launched from anywhere. The launcher looks like any one of the tens of millions of shipping containers floating around on the ocean, or sitting at ports, or riding along on trucks, or sitting on industrial lots. The launchers for these missiles are hiding in plain sight, in other words. Whatever tactical advantages great-power countries have in ballistics is going away, fast; 1,300 kilometers is 800 miles, and so the range is anything within 800 miles of wherever someone can send a shipping container. To keep the price down, the missile is reportedly using civilian-grade materials and widely available commercial parts, along with simpler manufacturing methods like die-casting. There are also broader savings from tapping mature supply chains and using China's large-scale civilian industrial base.

Read more of this story at Slashdot.

Read the whole story
Share this story
Delete

How can I change a dialog box’s message loop to do a Msg­Wait­For­Multiple­Objects instead of Get­Message?

2 Shares

A customer wanted to know how to change a dialog box’s message loop so that it used Msg­Wait­For­Multiple­Objects instead of Get­Message. (I’m guessing that they had a handle that they wanted to wait on while the dialog was up.) The standard dialog box message loop checks only for messages, not kernel handles.

One way to do it is to replace the modal dialog box with a modeless one and run your own message loop. However, there’s a key piece missing from the do-it-yourself, which is that there is no way to know whether the dialog procedure has called End­Dialog, and if so, what result code it passed.

So maybe you’re displaying somebody else’s dialog box and therefore cannot alter the dialog procedure to set a different flag when it wants to end the dialog. What can you do to customize the dialog loop from the outside?

Dialog boxes send their owner the WM_ENTER­IDLE message when they have run out of work to do and are about to block waiting for a message. if the handler of the WM_ENTER­IDLE message returns, and there is no posted message in the queue, then the dialog box goes to sleep and waits for a message to come in.

As the name of the message suggests, one way to use the WM_ENTER­IDLE message is to handle the message by doing do background idle-time activity, and then return when there is a message for the dialog box to process. For example, maybe you want to do spell checking when the user is idle.

Another way to use the WM_ENTER­IDLE message is to take over how the dialog message loop waits for a message. You can do your own thing, and return when there is a posted message that needs processing.

So let’s try it. Just for demonstration purposes, we’ll create a waitable timer that beeps every two seconds while a common file open dialog is up.

Start with our scratch program and make these changes. Remember that error checking has been elided for expository purposes.

#include <commdlg.h>

HANDLE hTimer;

void OnChar(HWND hwnd, TCHAR ch, int cRepeat)
{
    if (ch != ' ') return;

    hTimer = CreateWaitableTimerW(nullptr, FALSE, nullptr);

    LARGE_INTEGER twoSeconds;
    twoSeconds.QuadPart = -2 * wil::filetime_duration::one_second;
    SetWaitableTimer(h, &twoSeconds, 2000, nullptr, nullptr, FALSE);

    TCHAR buffer[MAX_PATH]{};
    OPENFILENAME ofn{};
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = TEXT("All Files\0*.*\0");
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = buffer;
    ofn.nMaxFile = ARRAYSIZE(buffer);
    GetOpenFileName(&ofn);

    CloseHandle(hTimer);
    hTimer = nullptr;
}

Our WM_CHAR handler ignores all characters other than the space bar. But if you press the space bar, it creates a waitable timer that triggers every two seconds, and then it displays a dialog: In this case, it’s the common file open dialog. When the dialog is finished, we close the timer since we don’t need it any more. This is just setting up the environment for our WM_ENTER­IDLE handler to do its magic.

The interesting work happens in the next function.

void OnEnterIdle(HWND hwnd, UINT source, HWND hwndSource)
{
    if (!hTimer) return;

    MSG msg;
    while (true) {
        DWORD result = MsgWaitForMultipleObjects(1, &hTimer,
                                FALSE, INFINITE, QS_ALLINPUT);
        switch (result) {
        case WAIT_OBJECT_0:
            MessageBeep(~0);
            break;

        case WAIT_OBJECT_0 + 1:
            if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
                return;
            }
            break;

        default:
            FAIL_FAST_HR(E_UNEXPECTED);
        }
    }
}

When we get a WM_ENTER­IDLE message and there is no timer handle, then just return without doing anything, allowing the dialog box message loop to go idle.

But if we have a timer handle, then we use the Msg­Wait­For­Multiple­Obcjets function to wait for either the timer handle to be signaled or for a message to arrive. If it was the timer handle, we beep. If it was a message, we call Peek­Message to process any inbound Send­Message calls and see if there’s a posted message waiting. if so, then we leave it in the message queue (PM_NO­REMOVE) for the dialog loop to pick up and return. If we get any other code, then something went horrible wrong, and we fail fast.

Now we can hook these up to our window procedure.

    HANDLE_MSG(hwnd, WM_CHAR, OnChar);
    HANDLE_MSG(hwnd, WM_ENTERIDLE, OnEnterIdle);

When the common dialog box goes idle, the internal dialog message pump sends a WM_ENTER­IDLE message to the owner (which is us), and we do our handle stuff until a posted message is ready.

When you run this program, press the space bar, and you get a happy common dialog box, accompanied by some annoying beeping.

I pulled a trick here. Maybe you noticed it. We’ll look at it next time.

The post How can I change a dialog box’s message loop to do a <CODE>Msg­Wait­For­Multiple­Objects</CODE> instead of <CODE>Get­Message</CODE>? appeared first on The Old New Thing.

Read the whole story
Share this story
Delete
Next Page of Stories